package com.fjb.controller.plugins;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.compiler.support.AdaptiveCompiler;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.config.spring.schema.DubboNamespaceHandler;
import org.apache.dubbo.registry.RegistryFactory;
import org.apache.dubbo.rpc.Exporter;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Protocol;
import org.apache.dubbo.rpc.RpcException;

import com.alibaba.fastjson.JSON;

/**
 * @Description:Protocol 
 * @author hemiao
 * @time:2020年3月18日 下午7:28:30
 */
public class MyProtocol implements Protocol{

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		AdaptiveCompiler.setDefaultCompiler("666666");
	}

	@Override
	public <T> Exporter<T> export(Invoker<T> arg0) throws RpcException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getDefaultPort() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public <T> Invoker<T> refer(Class<T> arg0, URL arg1) throws RpcException {
		// TODO Auto-generated method stub
		return null;
	}
	
	public static void main(String[] args) {
		
		Protocol refprotocol = ExtensionLoader.getExtensionLoader(Protocol.class).getDefaultExtension();
		System.out.println(JSON.toJSON(refprotocol));
		Protocol refprotocol2 = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("dubbo");
		System.out.println(JSON.toJSON(refprotocol2));
		
		DubboNamespaceHandler cast = DubboNamespaceHandler.class.cast("");
		
		
		RegistryFactory.class.cast("");
	}
}
